<?php
namespace Mobile\Controller;
use Think\Controller;
class IndexController extends BaseController {
    public function index(){
     	$data = M('donation')->where(array('is_delete' => 1))->order('money DESC')->select();
     	$path = get_path(get_config('mobile_logo'));
     	$music = get_path(get_config('mobile_music'));
     	$this->assign('path', $path);
     	$this->assign('music', $music);
     	$this->assign('data', $data);
        $article = M('article')->where(array('is_delete' => 1))->find(11);
        if(empty($data)) {
            $this->error('ID错误', U('Index/index'));
        }
        $this->assign('article', $article);
     	$this->display();
    }

    public function search($keyword = ''){
    	if($keyword) {
    		$R = D('Home/Donation')->search($keyword);
    		if(empty($R)) {
    			$this->error('搜索无结果');
    		}
    		$this->assign('data', $R);
    		$this->display('searchResult');
    	} else {

    		$this->display('search');
    	}

    	
    }


}